<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>while</title>
</head>
<body>
    <script>
        var sum = 0;
        var num = 1;
        while (num <= 100){
            sum += num;
            num++;
        }
        alert(sum)
    </script>
</body>
</html>